import { Rule } from "ant-design-vue/es/form";

export const rules: Record<string, Rule[]> = {
    name: [
        { required: true, message: '请输入名称', trigger: 'blur' },
        { min: 2, max: 20, message: '名称长度2-20位', trigger: 'blur' },
        {
            pattern: new RegExp(/^((?!\+|\.|\\|\/|:|\*|\?|\!|<|>|\||'|%|@|#|&|\$|\^|&|\*).){1,50}$/),
            message: '名称不允许包含特殊字符',
            trigger: 'blur'
        }
    ],
    code: [
        { required: true, message: '请输入编码', trigger: 'blur' }
    ],
    type: [
        {
            required: true,
            message: '请选择菜单类型',
            trigger: 'change'
        }
    ],
    extend: [
        {
            required: true,
            message: '请选择是否跳出',
            trigger: 'change'
        }
    ],
    path: [
        {
            required: true,
            message: '路径不能为空',
            trigger: 'change'
        }
    ]
}